import { createBrowserRouter } from "react-router-dom";
import { Children, lazy } from "react";
import {
  HomeOutlined,
  LoadingOutlined,
  SettingFilled,
  SmileOutlined,
  SyncOutlined,
} from '@ant-design/icons';
import Error from "../pages/404/Index";
import Layout from "antd/es/layout/layout";

let Home = lazy(() => import("../pages/home/Index"));
let Order = lazy(() => import("../pages/order/Index"));
let Shoporder=lazy(()=>import('../pages/shoporder/Index'))
export let childroute = [
  {
    path: "/",
    element: <Home></Home>,
    icon: <HomeOutlined/>,
    name: "首页商品",
  },
  {
    path: "/order",
    element: <Order></Order>,
    icon: <HomeOutlined/>,
    name: "订单商品",
    children: [
      {
        path: "/order",
        element: <Shoporder></Shoporder>,
        icon: <HomeOutlined/>,
        name: "生活商品",
      },
    ],
  },

];

let route = createBrowserRouter([
  {
    path: "/",
    element: <Layout></Layout>,
    children: childroute,
  },

  {
    path: "*",
    element: <Error></Error>,
  },
]);

export default route;
